<?php
       include_once 'function.php';
        if (isset($_GET['vrach'])){
                $tempFile = $_FILES['Filedata']['tmp_name'];
                $targetPath = '/web/smailopsru/site/www/images/catalog/';

                $targetFile =  str_replace('//','/',$targetPath.'/'.$_GET['vrach']).'.jpg';
                try {
                    move_uploaded_file($tempFile,$targetFile);
                    file_put_contents('12', $targetFile);
                    $dst=str_ireplace('.jpg', '---200.jpg', $targetFile);
                    _easyResize($targetFile, $dst,90,200);
                    $dst=str_ireplace('.jpg', '---100.jpg', $targetFile);
                    _easyResize($targetFile, $dst,90,100);
                }catch (Exception $e) {
                    file_put_contents('123', $e->getMessage());
                }
                return true;

        }            
        if (isset($_GET['catalog'])){ 
                $tempFile = $_FILES['Filedata']['tmp_name'];
                $targetPath = '/web/smailopsru/site/www/images/catalog/';

                $targetFile =  str_replace('//','/',$targetPath.'/'.$_GET['catalog']).'.jpg';
                try {
                    move_uploaded_file($tempFile,$targetFile);
                    file_put_contents('12', $targetFile);
                    $dst=str_ireplace('.jpg', '---286.jpg', $targetFile);
                    _easyResize($targetFile, $dst,90,286);
                    $dst=str_ireplace('.jpg', '---100.jpg', $targetFile);
                    _easyResize($targetFile, $dst,90,100);
                }catch (Exception $e) {
                    file_put_contents('123', $e->getMessage());
                }
                return true;

        }            
        if (isset($_GET['menu'])){ 
                $tempFile = $_FILES['Filedata']['tmp_name'];
                $targetPath = '/web/smailopsru/site/www/images/menu/';

                $targetFile =  str_replace('//','/',$targetPath.'/'.$_GET['menu']).'.png';
                try {
                    move_uploaded_file($tempFile,$targetFile);
                }catch (Exception $e) {
                    file_put_contents('123', $e->getMessage());
                }
                return true;

        }            
        
?>
